package LeetCode.leetcode206reverseList;


class Solution {
    public ListNode reverseList(ListNode head) {
        ListNode slow = null;
        ListNode fast = head;
        ListNode tmp;
        if (head == null) return null;
        while (fast.next != null) {
            tmp = fast.next;
            fast.next = slow;
            slow = fast;
            fast = tmp;
        }
        return fast;
    }
}